package com.wg.web_app.dao;

import javax.sql.DataSource;

import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

public class JDBCHolder {
	private static JdbcTemplate jdbcT = null;
	
	static public JdbcTemplate getJDBCTemplate(){
		if(jdbcT == null){
			synchronized (JDBCHolder.class) {
				if(jdbcT == null){
					FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext("Beans.xml");
					jdbcT = new JdbcTemplate((DataSource)context.getBean("dataSource"));
					context.close();
				}
			}
		}
		return jdbcT;
	}
}
